package com.net.xpay.core.helper;

import com.net.xpay.core.domain.AccountDetail;
import com.net.xpay.core.enums.AccountBillType;
import com.net.xpay.core.enums.AccountFundType;
import com.net.xpay.core.enums.BillPayMethod;
import com.net.xpay.core.enums.PayStatus;
import org.springframework.stereotype.Component;

/**
 * 2020/5/11 14:36

 */
@Component
public class AccountDetailHelper {

    public void initCommonAccountDetail(AccountDetail accountDetail, AccountBillType type, Long accountMoney, String memo) {
        accountDetail.setType(type);
        accountDetail.setAccountFundType(AccountFundType.MONEY);
        accountDetail.setBillPayMethod(BillPayMethod.ALL_ACCOUNT);
        accountDetail.setPayStatus(PayStatus.WAIT_PAY);

        accountDetail.setMemo(memo != null ? memo : "");
        accountDetail.setChange(accountMoney);
    }

    /**
     * 转账批次增减
     */
    public void initTransBatchAccountDetail(AccountDetail accountDetail, AccountBillType type, Long change, String memo) {
        accountDetail.setType(type);
        accountDetail.setAccountFundType(AccountFundType.TRANS_BATCH);
        accountDetail.setBillPayMethod(BillPayMethod.ALL_ACCOUNT);
        accountDetail.setPayStatus(PayStatus.WAIT_PAY);

        accountDetail.setMemo(memo != null ? memo : "");
        accountDetail.setChange(change);
    }
}
